local M = require "packages/mamashengde/record/Made"

local haiyou = fk.CreateSkill {
  name = "shine__haiyou",
}

Fk:loadTranslationTable {
  ["shine__haiyou"] = "海佑",
  [":shine__haiyou"] = "称号与你相同的角色成为牌的目标时，你可以消耗1点魔力令之无效。",
  ["#shine__haiyou"] = "海佑：你可以消耗1点魔力令 %arg 对 %dest 无效",
}

haiyou:addEffect(fk.TargetConfirming, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(haiyou.name) and target and M.getHonor(target) == M.getHonor(player) and M.getMaryoku(player) > 0
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player,{
      skill_name = haiyou.name,
      prompt = "#shine__haiyou::"..target.id..":"..data.card:toLogString(),
    })
  end,
  on_use = function (self, event, target, player, data)
    M.changeMaryoku(player, -1 ,haiyou.name)
    data:cancelTarget(player)
  end,
})

return haiyou